#include "SFML/Graphics.hpp"
#include "Screen.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_projection.hpp>
#include <glm/gtc/matrix_transform.hpp>



using namespace std;

#ifndef __CAMERA_HPP__
#define __CAMERA_HPP__

#define cameraAngle 60.0


/** class for managing LME camera */
class Camera {
	protected:
		/** camera position */
		glm::vec3 m_position;

		/** point where the camera is focused */
		glm::vec3 m_lookAt;

		/** camera speed */
		glm::vec3 m_speed;

		/** singleton camera pointer */
		static Camera* m_singleCamera;

		/** maximal distance from the camera for an object to be displayed (and viewed) */
		float m_clippingDistance;
	public:
		/** constructor : vector initialization */
		Camera(); 

		/** retrieve pointer to single camera */
		static Camera* getCamera();

		void setClippingDistance(float d_) { m_clippingDistance = d_;};

		/** initialize openGL viewport */
	    void initializeViewport();

		/** defining camera position */
	    void setPosition(glm::vec3);

		/** defining camera lookAt point */
		void setLookAt(glm::vec3);

		/** setting viewport, used for defining rendering 
		  * according to camera parameters */
    	void setViewport();

		/** setting viewport for rendering reflects */
		void setReflectViewport();

		/** translating camera with arg vector */
    	void translate(glm::vec3);

		/** setting camera speed */
	    void setSpeed(glm::vec3 speed);

		/** updating camera position */
	    virtual void update(float time);

		/** retrieving camera position */
    	glm::vec3 getPosition() { return m_position;};

		/** retrieving camera shift from original position 
	  	* TODO : to be abstracted by adding m_initialPosition member */
    	virtual glm::vec3 getShift() { return m_position - glm::vec3(50.f,50.f,0.f);};

		/** zoom in function */
		void zoomIn() {m_position.z -= 3;};

		/** zoom out function */
		void zoomOut() { m_position.z +=3;};

		/** move the camera in order to have point_ at the focus center*/
		void centerOn(glm::vec3 point_);
};

#endif
